import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PriceTrendsVO, PriceTrendsForm, PriceTrendsQuery } from '@/api/business/priceTrends/types';

/**
 * 查询价格趋势列表
 * @param query
 * @returns {*}
 */

export const listPriceTrends = (query?: PriceTrendsQuery): AxiosPromise<PriceTrendsVO[]> => {
  return request({
    url: '/business/priceTrends/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询价格趋势详细
 * @param id
 */
export const getPriceTrends = (id: string | number): AxiosPromise<PriceTrendsVO> => {
  return request({
    url: '/business/priceTrends/' + id,
    method: 'get'
  });
};

/**
 * 新增价格趋势
 * @param data
 */
export const addPriceTrends = (data: PriceTrendsForm) => {
  return request({
    url: '/business/priceTrends',
    method: 'post',
    data: data
  });
};

/**
 * 修改价格趋势
 * @param data
 */
export const updatePriceTrends = (data: PriceTrendsForm) => {
  return request({
    url: '/business/priceTrends',
    method: 'put',
    data: data
  });
};

/**
 * 删除价格趋势
 * @param id
 */
export const delPriceTrends = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/priceTrends/' + id,
    method: 'delete'
  });
};
